package com.example.tuter.util.httpUtil.HttpFunction;

import com.example.tuter.entity.CourseInformation;
import com.example.tuter.entity.Message;
import com.example.tuter.entity.Room;
import com.example.tuter.entity.SemesterPair;

import java.util.ArrayList;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Url;

public interface SSFWAPI {

    String KXJS = "http://ssfw.tjut.edu.cn/ssfw/kxjs/query.do";
    String Referer = "http://ssfw.tjut.edu.cn/ssfw/index.do";
    String Kcbxx_pre = "http://ssfw.tjut.edu.cn/ssfw/pkgl/kcbxx/4/";
    String Semester_url = "http://ssfw.tjut.edu.cn/ssfw/combobox.widgets?name=xnxq&cascol=&casval=&order=";

    @POST("/kxjs")
    @FormUrlEncoded
    Call<Message<Room>> getKxjs(
            @Field("curPageNo")Integer curPageNo,
            @Field("iDisplayLength")Integer length,
            @Field("qJsmc")String keyword,
            @Field("qXnxqdm")String unknown,
            @Field("qXq")String week,
            @Field("qKszc")Integer startWeek,
            @Field("qJszc")Integer endWeek,
            @Field("qKsjc")String ksjc,
            @Field("qJsjc")String jsjc);


    //{{url}}/kcbxx
    @POST("/kcbxx")
    @FormUrlEncoded
    Call<Message<CourseInformation>> getKcbxx(@Field("year")String year, @Field("semester")Integer semester);



    /**
     * //Referer: http://ssfw.tjut.edu.cn/ssfw/index.do 要添加这个头,从这个接口中获取到今天是第几周，和年份。
     * @param url
     * @param cookie
     * @param refer
     * @return
     */
    @GET
    Call<ResponseBody> getKxjs(@Url String url, @Header("cookie") String cookie, @Header("Referer") String refer);


    //http://ssfw.tjut.edu.cn/ssfw/pkgl/kcbxx/4/2022-2023-2.do

    @GET
    Call<ResponseBody> getKcbxx(@Url String url,@Header("cookie") String cookie);

    @GET
    Call<ArrayList<SemesterPair>> getSemesters(@Url String url,@Header("cookie") String cookie);

}
